//
//  MainViewController.m
//  多视图切换
//
//  Created by student on 16/2/23.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "MainViewController.h"

#import "First View.h"

#import "Second View.h"

#import "Third View.h"

@interface First_View ()
@property (nonatomic,strong) First_View *firstFV;

@property (nonatomic,strong) Second_View *secondFV;

@property (nonatomic,strong) Third_View *thirdFV;

@property (nonatomic,assign) BOOL curSecond;

@end

@implementation First_View

- (First_View *)firstFV
{
    if (!_firstFV)
    {
        _firstFV = [[First_View alloc] init];
    }
    return _firstFV;
}

- (Second_View *)secondFV
{
    if(!_secondFV)
    {
        _secondFV = [[Second_View alloc] init];
    }
    return _secondFV;
}
- (Third_View *)thirdFV
{
    if(!_thirdFV)
    {
        _thirdFV = [[Third_View alloc] init];
    }
    return _thirdFV;
}





- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */


- (IBAction)First_View:(id)sender
{
    //动画效果
        [UIView beginAnimations:@"ViewFlip" context:nil];
        [UIView setAnimationBeginsFromCurrentState:1.25];//动画时间
        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];//运动方式
    [self.view insertSubview:self.firstFV.view atIndex:0];
    [self.secondFV.view removeFromSuperview];
    [self.thirdFV.view removeFromSuperview];
        [UIView commitAnimations];
    
}

- (IBAction)Second_View:(id)sender
{
    //动画效果
        [UIView beginAnimations:@"ViewFlip" context:nil];
        [UIView setAnimationBeginsFromCurrentState:1.25];//动画时间
        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    
    [self.view insertSubview:self.secondFV.view atIndex:0];
    [self.firstFV.view removeFromSuperview];
    [self.thirdFV.view removeFromSuperview];
        [UIView commitAnimations];
    
}

- (IBAction)Third_View:(id)sender
{
    //动画效果
        [UIView beginAnimations:@"ViewFlip" context:nil];
        [UIView setAnimationBeginsFromCurrentState:1.25];//动画时间
        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];//运动方式
    [self.view insertSubview:self.thirdFV.view atIndex:0];
    [self.secondFV.view removeFromSuperview];
    [self.firstFV.view removeFromSuperview];
        [UIView commitAnimations];
    
}


















@end
